-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implements a mapper option #6940
Conversation
This is failing CI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm missing the bigger picture (use case) here, but the code itself looks good :)
@@ -42,6 +42,7 @@ const STRAWBERRY = path.join(FRUITS, 'strawberry.js'); | |||
const KIWI = path.join(FRUITS, 'kiwi.js'); | |||
const TOMATO = path.join(FRUITS, 'tomato.js'); | |||
const MELON = path.join(VEGETABLES, 'melon.json'); | |||
const DURIAN = path.join(VEGETABLES, 'durian.zip'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this theme!
@@ -127,6 +127,10 @@ function findNative( | |||
module.exports = function nodeCrawl( | |||
options: CrawlerOptions, | |||
): Promise<InternalHasteMap> { | |||
if (options.mapper) { | |||
throw new Error(`Option 'mapper' isn't supported on this crawler`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Option 'mapper' is not supported in the node crawler"?
Will fix the tests tomorrow 👍
I'm figuring out ways to access the content of zip archives as if they were raw files (without unpacking them). In the case of Jest Haste Map, it requires to fake the existence of those "virtual files" (since Watchman isn't aware about them), so the idea is that the configured mapper will detect such archives and replace them by their directory listing in the haste map. |
@SimenB the travis failure doesn't seem related to my diff, right? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
This PR allows
jest-haste-map
to generate additional files that aren't actually baked by the filesystem. The implementation is partial and experimental, since it doesn't remove the virtual files when their source file is being removed (they would have to be linked together in some way).Test plan
Added a test.